Add copy workspace path button to thread action menu#1128
Add copy workspace path button to thread action menu#1128juliusmarminge merged 2 commits intopingdotgg:mainfrom
Conversation
📝 WalkthroughWalkthroughA "Copy Path" option was added to the thread context menu in the Sidebar component. The feature resolves the thread workspace path using thread.worktreePath or projectId fallback, validates the thread exists, and copies the path to clipboard with appropriate success or error toast notifications. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/src/components/Sidebar.tsx (1)
660-684: Consider extracting shared clipboard+toast flow.
copy-pathandcopy-thread-idnow repeat nearly identical copy/error toast handling. A small helper would reduce drift and keep copy actions consistent.Refactor sketch
+const copyValueWithToast = async ({ + value, + successTitle, + failureTitle, +}: { + value: string; + successTitle: string; + failureTitle: string; +}) => { + try { + await copyTextToClipboard(value); + toastManager.add({ type: "success", title: successTitle, description: value }); + } catch (error) { + toastManager.add({ + type: "error", + title: failureTitle, + description: error instanceof Error ? error.message : "An error occurred.", + }); + } +};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/src/components/Sidebar.tsx` around lines 660 - 684, Extract the repeated clipboard + toast logic into a helper like copyToClipboardWithToast(text: string, options?: {successTitle?: string, successDescription?: string, errorTitle?: string}) and use it from the click handlers for "copy-path" and "copy-thread-id"; move the existing try/catch and toastManager.add calls into that helper, have it check for empty text (returning a failure toast similar to the current "Path unavailable"), call copyTextToClipboard inside the try block, and surface either a success toast with the provided title/description or an error toast using error instanceof Error ? error.message : "An error occurred." so both handlers call copyToClipboardWithToast(threadWorkspacePath, {successTitle: "Path copied"}) and copyToClipboardWithToast(threadId, {successTitle: "Thread ID copied"}) respectively.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/web/src/components/Sidebar.tsx`:
- Around line 660-684: Extract the repeated clipboard + toast logic into a
helper like copyToClipboardWithToast(text: string, options?: {successTitle?:
string, successDescription?: string, errorTitle?: string}) and use it from the
click handlers for "copy-path" and "copy-thread-id"; move the existing try/catch
and toastManager.add calls into that helper, have it check for empty text
(returning a failure toast similar to the current "Path unavailable"), call
copyTextToClipboard inside the try block, and surface either a success toast
with the provided title/description or an error toast using error instanceof
Error ? error.message : "An error occurred." so both handlers call
copyToClipboardWithToast(threadWorkspacePath, {successTitle: "Path copied"}) and
copyToClipboardWithToast(threadId, {successTitle: "Thread ID copied"})
respectively.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: dc7bb203-8b66-4563-b073-d33616adbc10
📒 Files selected for processing (1)
apps/web/src/components/Sidebar.tsx
- Add `Copy Path` to the thread context menu in the sidebar - Resolve thread path from `worktreePath` with project cwd fallback - Show success/error toasts for copy and unavailable path cases
94dfe02 to
46fc372
Compare
|
Also, why is 30 - 99 lines considered medium? It's not a big change at all... |
|
@jamesx0416 We see it as a Medium, as its not something we can just approve and believe it wont affect the UX. S and XS are usually super quick wins that barely require any time :) |
|
@binbandit I'm still quite new to open source, and I'm not very used to the etiquette. And would there be a Discord server coming soon? Thank you. P.S. would it be easier if I link a packaged version for you guys to test out? |
|
@jamesx0416 all good mate. I for one am ok with being tagged on things as long as it's within reason. Don't need to be tagged on something because you find it funny 😂. In terms of the PRs we are using tools that help us see every pr, and we are slowly getting through them all. In terms of a discord server there is a general discord server owned by Theo where there is a generalized chat channel for t3code. But we don't recommend pasting / flooding it with pull request links. TLDR; tag me on stuff if u want. Don't bother the other maintainers tho. If it's dope I'll pass it on for you |
|
@binbandit Thanks. Would it be easier if I link a package version of my PR for you guys to test out in the future? |
What Changed
Adds a
Copy Pathaction to the thread right-click menu in the left sidebar.The copied path prefers the thread worktree path and falls back to the project cwd when the thread is not using a separate worktree.
Why
This makes it easier to grab the workspace path for a thread directly from the sidebar without opening the thread and manually finding the path elsewhere.
UI Changes
Adds a new
Copy Pathentry to the existing thread context menu in the sidebar.Checklist
Verification
bun lintbun typecheckScreenshots
Before:

After:

Note
Add 'Copy Path' option to thread context menu in sidebar
Adds a new "Copy Path" item to the right-click context menu for threads in Sidebar.tsx. The item copies the thread's
worktreePath, falling back to the project's current working directory, and shows a success or error toast based on availability.Macroscope summarized 26123af.
Summary by CodeRabbit